<template>
  <!-- hidden PageHeaderWrapper title demo -->
  <page-header-wrapper :title="false" >
    <a-card :body-style="{padding: '24px 32px'}" :bordered="false">
      <a-alert type="error" message="修改业务酬金、积分、提成即时生效，如果已经下账没有及时修改酬金、积分、提成可使用本功能将自生效日期之日起(包含生效之日)所有运营商业务按照当前设置重新计算酬金、积分、提成。" />
      <a-form @submit="handleSubmit" :form="form" style="margin-top: 24px;">
        <a-form-item
          label="生效日期"
          :labelCol="{lg: {span: 7}, sm: {span: 7}}"
          :wrapperCol="{lg: {span: 10}, sm: {span: 17} }">
          <a-date-picker
            style="width: 100%"
            v-decorator="['effDate']" 
            valueFormat="YYYY-MM-DD"/>
        </a-form-item> 
        <a-form-item
          :wrapperCol="{ span: 24 }"
          style="text-align: center"
        >
          <a-button htmlType="submit" type="primary" icon="check">提交</a-button>
          <!-- <a-button style="margin-left: 8px">{{ $t('form.basic-form.form.save') }}</a-button> -->
        </a-form-item>
      </a-form>
    </a-card>
  </page-header-wrapper>
</template>
  
<script>
  import { setGoodsEffDateUsingPOST1 } from '@/api/api/yunyingshangguanli.ts'
  import moment from 'moment'
  export default {
    name: 'MobileDate',
    data () {
      return {
        form: this.$form.createForm(this)
      }
    },
    methods: {
      // handler
      handleSubmit (e) {
        e.preventDefault()
        this.form.validateFields((err, values) => {
          if (!err) {
            setGoodsEffDateUsingPOST1({ effDate: values?.effDate}).then(() => { 
              this.$message.success('操作成功')
              this.$router.back()
              // 重置表单数据
              this.form.resetFields()
            })
            .catch((error) => {
              this.$message.error(((error.response || {}).data || {}).msg || '请求出现错误')
            })
          }
        })
      }
    }
  }
</script>